Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minting Handles For Datasets #3146

Closed
wants to merge 17 commits into from
Closed

Minting Handles For Datasets #3146

wants to merge 17 commits into from

Conversation

jo-pol
Copy link
Contributor

@jo-pol jo-pol commented May 31, 2016

Implementation of Minting Handles For Datasets, see BRD

Some refactoring makes the dataset commands classes agnostic which IdServiceBean is configured: DOIEZIDServiceBean, DOIDataciteServiceBean or HandlenetServiceBean. When an id is registered is hard coded per bean: upon creation for EZID, upon publishing for DataCite and Handlenet.


1. Related Issues


2. Pull Request Checklist

  • Functionality completed as described in FRD
  • Dependencies, risks, assumptions in FRD addressed
  • Unit tests completed
  • Deployment requirements identified (e.g., SQL scripts, indexing)
  • Documentation completed
  • All code checkins completed

3. Review Checklist

After the pull request has been submitted, fill out this section.

  • Code review completed or waived
  • Testing requirements completed
  • Usability testing completed or waived
  • Support testing completed or waived
  • Merged with develop branch and resolved conflicts

… warnings

@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 5.138% when pulling 84eb5d4 on jo-pol:DDN-184-DOI-interface into 2935cde on IQSS:develop.

@jo-pol
Copy link
Contributor Author

jo-pol commented Jun 28, 2016

@4tikhonov
At last I found my work done so far.

@janvanmansum
I suppose we will need a fork at DANS-KNAW with a dans-develop-4.x branch (like IISH) and figure out a branching strategy to get things merged into the develop branch of IQSS

@djbrooke
Copy link
Contributor

djbrooke commented Aug 2, 2016

@scolapasta is going to correspond with @jo-pol about this one.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.009%) to 6.791% when pulling b1f171b on jo-pol:DDN-184-DOI-interface into 054cafb on IQSS:develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 6.789% when pulling 3d87237 on jo-pol:DDN-184-DOI-interface into e31b7d5 on IQSS:develop.

@jo-pol
Copy link
Contributor Author

jo-pol commented Aug 16, 2016

In the process of testing.

  • Needed to base my own changes on 47b04ed which is tagged with 4.4, see new branch with additional refactoring. Only then http://ddvn.dans.knaw.nl:8080/dataverse.xhtml (our vagrant instance, a private variant of dataverse-ansible) did not throw an internal error by DataverseRoleServiceBean (column "privateurltoken" does not exist b629598) after /usr/local/glassfish4/bin/asadmin deploy of my own dataverse.war Figured out I needed to execute scripts/database/upgrades/upgrade_v4.4_to_v4.5.sql
  • Creating a dataset succeeds but I haven't seen my fine logging yet in /usr/local/glassfish4/glassfish/domains/domain1/logs/server.log despite a asadmin set-log-levels of the classes that I changed.

update

  • deaccession also seems OK as it logs errors nor warnings, managed to republish once but don't know how to reproduce
  • trigger UpdateDatasetTargetURLCommand
  • replace the default configuration with EZID by Datacite
  • provoke/mock exceptions

@jo-pol
Copy link
Contributor Author

jo-pol commented Aug 19, 2016

getLogger is usually called with .class.getCanonicalName, I also see .class.getName and .class.getPackage().getName() but worst of all: hardcoded strings for DOIDataCiteServiceBean, DOIEZIdServiceBean (with a wrong package name), HandlenetServiceBean and DataciteMetadataTemplate.

Should that be fixed?

@jo-pol
Copy link
Contributor Author

jo-pol commented Aug 19, 2016

CreateDatasetCommand sets GlobalIdCreateTime if createIdentifier was successful for EZId. Subsequently UpdateDatasetCommand retries if GlobalIdCreateTime is missing. Why is this mechanism not implemented for DataCite? In both cases createIdentifier can fail.

@pdurbin
Copy link
Member

pdurbin commented Aug 19, 2016

I pinged @sekmiller about these questions and he'll be working with @jo-pol on answering them.

@pdurbin pdurbin assigned sekmiller and unassigned scolapasta Aug 19, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.009%) to 6.773% when pulling c92614c on jo-pol:DDN-184-DOI-interface into e31b7d5 on IQSS:develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.008%) to 6.775% when pulling a56a771 on jo-pol:DDN-184-DOI-interface into e31b7d5 on IQSS:develop.

# Conflicts:
#	src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeaccessionDatasetVersionCommand.java
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 7.927% when pulling cfd7f26 on jo-pol:DDN-184-DOI-interface into dc58ae1 on IQSS:develop.

@sekmiller
Copy link
Contributor

Summarizing what I said in our chat previously:

The UpdateDatasetTargetURLCommand is triggered via the native API
with the following: GET http://$server/api/datasets/modifyRegistrationAll

It is only something that an admin would use since it updates the Target URL at the DOI service provider. We used it on the deployment of 4.0 and also when we added more widget functionality in 4.2 or 4.3 since these resulted in a change to Dataverse's base URL

@sekmiller
Copy link
Contributor

With regard to the UpdatDatasetCommand not trying to register DataCite datasets. This is because DataCite does not allow for a reserved (non-public) identifier. On create of a DataCite dataset we get an identifier for the dataset, but we don't actually register it with DataCite until the dataset is published. It's at that time we will register it with DataCite.

@sekmiller
Copy link
Contributor

We should definitely fix the logger calls. Thanks for picking up on that.

Also, with respect to mock/provoke exceptions: we do need to add more unit testing. There was some work done regarding the base testing of commands that I think was merged into develop recently. I will take a look at it and see if it will help with adding testing here.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 7.926% when pulling 5c35dc4 on DANS-KNAW-jp:DDN-184-DOI-interface into dc58ae1 on IQSS:develop.

} catch (Exception e){
logger.log(Level.WARNING, "Exception while creating Identifier: " + e.getMessage(), e);
}

// Check return value to make sure registration succeeded
if (doiProvider.equals("EZID") && doiRetString.contains(theDataset.getIdentifier())) {
if (!idServiceBean.registerWhenPublished() && doiRetString.contains(theDataset.getIdentifier())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's my intention to drop the check on the protocol once implementation of the handle service bean is completed.

There is still DestroyDatasetCommand calling ctxt.doiDataCite(). The last DatasetCommand that is not agnostic about the configured bean by calling IdServiceBean.getBean(ctxt) controlled with another property of an idServiceBean. Don't yet know how that property should be named and what the value for both properties should be for handlenet. Even I'm not sure whether these properties should be hard-coded or configurable. I also remember Ben wanted a handle to point to some resource with some original meta data and additional provenance about why/when the dataset was destroyed and who requested/executed/approved the action.

Rediscovering the API I guess the interface should be renamed into IdRegistrationServiceBean.

Copy link
Contributor

@raprasad raprasad Sep 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Yes, please rename this using PersistentIdRegistrationServiceBean instead of IdRegistrationServiceBean.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • For the AbstractIdServiceBean, please add a postDeleteCleanup cleanup method that will be called by the DestroyDatasetCommand.
    • public void postDeleteCleanup(){ ...}
    • Within the AbstractIdServiceBean, postDeleteCleanup can be added as a method that does nothing.
    • For the DataCite implementation, override the postDeleteCleanup method and add the DataCite cleanup

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 7.926% when pulling 322ce23 on DANS-KNAW-jp:DDN-184-DOI-interface into dc58ae1 on IQSS:develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 7.926% when pulling cafe13b on DANS-KNAW-jp:DDN-184-DOI-interface into dc58ae1 on IQSS:develop.

public String getIdentifierForLookup(String protocol, String authority, String separator, String identifier) {
logger.log(Level.FINE,"getIdentifierForLookup");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method seems the same to me for both EZId and Datacite and I suppose it should become the same for handlenet as well. If true we can pull this one up to the abstract service bean. Any future exception to the rule can still override.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 7.926% when pulling fd93ae8 on DANS-KNAW-jp:DDN-184-DOI-interface into dc58ae1 on IQSS:develop.

- pulled up methods to AbstractIdServiceBean
- implemented methods of HandleNetServiceBean that still threw a NotImplementedException and were called somewhere

This is a squashed commit of https://github.com/DANS-KNAW-jp/dataverse/pull/1
alias https://github.com/DANS-KNAW-jp/dataverse/tree/DDN-184-handle-implementation
@jo-pol jo-pol changed the title Plugable id service beans: DOI(EZId/Datacite) handles Minting Handles For Datasets Sep 16, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 7.926% when pulling 354e624 on DANS-KNAW-jp:DDN-184-DOI-interface into 3a753ca on IQSS:develop.

Copy link
Contributor

@raprasad raprasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please make the strings "doi" and "EZID" into re-usable variables.


String generateYear();

String generateTimeString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what we can tell, the generateTimeString method isn't actually used anywhere. I commented it out as of 354e624 and the app still compiles. Should we remove it?

String nonNullDefaultIfKeyNotFound = "";
String doiProvider = ctxt.settings().getValueForKey(SettingsServiceBean.Key.DoiProvider, nonNullDefaultIfKeyNotFound);

if ("hdl".equals(protocol))
Copy link
Member

@pdurbin pdurbin Sep 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hard coding "hdl" here can we make HANDLE_PROTOCOL_TAG public and reference that instead? That way we can define "hdl" just once.

@@ -236,7 +236,8 @@ public boolean isUniqueIdentifier(String userIdentifier, String protocol, String
boolean u = em.createQuery(query).getResultList().size() == 0;
String nonNullDefaultIfKeyNotFound = "";
String doiProvider = settingsService.getValueForKey(SettingsServiceBean.Key.DoiProvider, nonNullDefaultIfKeyNotFound);
if (doiProvider.equals("EZID")) {
if (protocol.equals("doi") && doiProvider.equals("EZID")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please make the strings "doi" and "EZID" into re-usable static variables.

import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class AbstractIdServiceBean implements IdServiceBean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the AbstractIdServiceBean class! It's a great help!

}

@Override
public String generateYear()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • generateYear this method is not needed. e.g. methods like getMetadataFromStudyForCreateIndicator will be overwritten

@jo-pol
Copy link
Contributor Author

jo-pol commented Oct 6, 2016

@4tikhonov : Sorry, no time to test these requested changes by myself

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 8.592% when pulling a43e2e9 on DANS-KNAW-jp:DDN-184-DOI-interface into 301e34a on IQSS:develop.

@kcondon
Copy link
Contributor

kcondon commented Oct 26, 2016

Hi @jo-pol,

I've just tested your handle code and found a few issues. I've updated the original ticket, #2437, with that info and tagged some of our developers who may be able to

Thanks for working on this!
Kevin

@pdurbin
Copy link
Member

pdurbin commented Oct 28, 2016

There's a related thread from this morning at https://groups.google.com/d/msg/dataverse-community/v6jgyewGqlI/ZYDnFfWqAgAJ

@pdurbin
Copy link
Member

pdurbin commented Apr 26, 2017

Replaced by pull request #3800. Closing.

@pdurbin pdurbin closed this Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants